import { createApp } from "vue";
import { createPinia } from "pinia";
import Taro from "@tarojs/taro";
import { useGlobalStore } from "./stores/globalStore";
import { getToken } from "./utils/auth.util";

import "./app.scss";

const App = createApp({
  onLaunch() {
    // 获取系统信息
    const systemInfo = Taro.getSystemInfoSync();
    const globalStore = useGlobalStore();
    globalStore.systemInfo = systemInfo;

    // globalStore.getMap();
    const token = getToken();

    if (token) {
      globalStore.isLogin = true;
    }
  },
  onShow(options) { },
  // 入口组件不需要实现 render 方法，即使实现了也会被 taro 所覆盖
});

App.use(createPinia());

export default App;
